/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.kpi.transport.servlet.actions.deleting;

import ua.kpi.transport.servlet.actions.lists.RoutesListAction;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ua.kpi.transport.db.dao.factory.DAOFactory;
import ua.kpi.transport.db.dao.factory.DBEnum;
import ua.kpi.transport.db.dao.interfaces.IRouteDAO;
import ua.kpi.transport.servlet.actions.IAction;

/**
 *
 * @author harker777
 */
public class DeleteRouteAction implements IAction{

    @Override
    public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        IRouteDAO rd = DAOFactory.getDAOFactory(DBEnum.MYSQL).getRouteDAO();
        Integer id = Integer.valueOf(request.getParameter("id"));
        rd.delete(rd.find(id));

        return new RoutesListAction().execute(request, response);
    }
    
}
